// Domien Nowicki & Raf Lempens
#include "QtCheckpointSprite.h"
#include "QtSequentialAnimationEffect.h"
#include "QtScaleToEffect.h"
#include "QtRotateToEffect.h"


QtCheckpointSprite::QtCheckpointSprite(QtSprite *parent): QtPixmapSprite(parent), duration(1000)
{
	SetDepth(1);

	SetResource("foreground", "checkpoint");
}

QtCheckpointSprite::~QtCheckpointSprite()
{
}


void QtCheckpointSprite::Reached()
{
	QtScaleToEffect effect;

	effect.SetDuration(duration/2);
	effect.SetTarget(this);
	effect.SetEndScale(Width()+20, Height()+20);

	AddEffect(&effect);

	QtRotateToEffect effect1, effect2;

	effect1.SetDuration(duration/4);
	effect1.SetTarget(this);
	effect1.SetEndAngle(Angle()-45);

	AddEffect(&effect1);

	effect2.SetDuration(duration/4);
	effect2.SetTarget(this);
	effect2.SetEndAngle(Angle()+45);

	AddEffect(&effect2);
	AddEffect(&effect1);
	AddEffect(&effect2);


	effect1.SetDuration(duration/4);
	effect1.SetTarget(this);
	effect1.SetEndAngle(Angle());

	AddEffect(&effect1);

	effect.SetEndScale(Width(), Height());

	AddEffect(&effect);

	Start();
}










